<?php

/*
 * Remove a language from a user
 *
 * @uses classes/babel/Find_Files.php
 * @package BABEL
 * @since   BABEL 0.1.0
 * @version $Id: remove_language.php 766 2008-05-14 08:52:59Z bjori $
 * @copyright Copyright (C) 2008 Knut Haug
 * @author  Knut Haug
 * @license LGPL
 */

include('includes/babel/prepend_no_gui.php');

$lang=$_GET["action"];

/*
 * SQL statement which remove a language from a user, making him unatble to 
 * translate to this language.
 *
 * 1param:
 * @lang - The language_id to remove
 */
$DB_QUERY = "
			DELETE FROM
				babel_user_skills
			WHERE 
				language_id = ?
			AND
				user_id = ?
			";

/* Executes the statement, and throws a new Exception if it fails.
 *
 * 2 params:
 * $langid  						- Languade id to remove
 * $_SESSION["user"]["user_id"] 	- Userid to remove the skill from
 */
if (!PDODB::execQuery($DB_QUERY, array($lang, $_SESSION["user"]["user_id"]))) {
	throw new Exception("Query failed");
}

unset($_SESSION["user"]["profile"]["language"][$lang]);


?>
